package values.item
{
import values.skill.SkillTemplateValueList;

/**
 * SkillBookItemTemplateValue
 * @author jliang
 *
 */
public class SkillBookItemTemplateValue extends NumbericItemTemplateValue
{
    //==========================================================================
    //  Constructor
    //==========================================================================
    public function SkillBookItemTemplateValue()
    {
        super();
    }
    //==========================================================================
    //  Overridden methods: ItemTemplateValue
    //==========================================================================
    /**
     *   <items>
             <skill_key>avatar_1_skill_1</skill_key>
		     <level>2</level>
         </items>
     */		
    [Data(type="field", mapping="params")]
    override public function set params(value:*):void
    {
        super.params = value;
    }
    
    override public function get dynamicClassRef():Class
    {
        return SkillBookItemValue;
    }
    //==========================================================================
    //  Properties
    //==========================================================================
    public function get skillKey():String
    {
        return String(params.skill_key);
    }
    
    public function get skillLevel():int
    {
        return int(params.level);
    }
    
    public function get avatarType():String
    {
        if (skillKey == null || skillKey == "") return "";
        return SkillTemplateValueList.getByKey(skillKey).avatarType;
    }
    
    public function get isUltimateSkillBook():Boolean
    {
        return avatarType == "";
    }
}
}




